]> git.saurik.com Git - apple/security.git/blob - Keychain Circle Notification/NSDictionary+compactDescription.m
Security-55471.14.tar.gz
[apple/security.git] / Keychain Circle Notification / NSDictionary+compactDescription.m
1 //
2 // NSDictionary+compactDescription.m
3 // KeychainMigrator
4 //
5 // Created by J Osborne on 2/19/13.
6 //
7 //
8
9 #import "NSDictionary+compactDescription.h"
10 #import "NSString+compactDescription.h"
11
12 @implementation NSDictionary (compactDescription)
13
14 -(NSString*)compactDescription
15 {
16 NSMutableArray *results = [NSMutableArray new];
17 for (NSString *k in self) {
18 id v = self[k];
19 if ([v respondsToSelector:@selector(compactDescription)]) {
20 v = [v compactDescription];
21 } else {
22 v = [v description];
23 }
24
25 [results addObject:[NSString stringWithFormat:@"%@=%@", [k compactDescription], v]];
26 }
27 return [NSString stringWithFormat:@"{%@}", [results componentsJoinedByString:@", "]];
28 }
29
30 -(NSString*)compactDescriptionWithoutItemData;
31 {
32 NSMutableArray *results = [NSMutableArray new];
33 for (NSString *k in self) {
34 if ([k isEqualToString:kSecValueData]) {
35 [results addObject:[NSString stringWithFormat:@"%@=<not-logged>", [k compactDescription]]];
36 continue;
37 }
38
39 id v = self[k];
40 if ([v respondsToSelector:@selector(compactDescription)]) {
41 v = [v compactDescription];
42 } else {
43 v = [v description];
44 }
45
46 [results addObject:[NSString stringWithFormat:@"%@=%@", [k compactDescription], v]];
47 }
48 return [NSString stringWithFormat:@"{%@}", [results componentsJoinedByString:@", "]];
49
50 }
51
52 @end